﻿#ifndef TCPTHREAD_H
#define TCPTHREAD_H

#include <QThread>
#include <QTcpSocket>
#include <ctime>
#include "chart.h"
/*
class Thread: public QThread
{
    Q_OBJECT
public:
    Thread();

protected:
    virtual void run() override;

};

class TCPWorker: public QObject
{
    Q_OBJECT
public:
    TCPWorker();
    ~TCPWorker();
    QTcpSocket *tcpSocket;

signals:
    void sigDTUUpdate(int, int);

private slots:
    void handleTimeout();
    void readData();

private:
    QByteArray cmdSend;
    QTimer* m_timer;
    clock_t begin,end;
};
*/

class TCPThread: public QThread
{
    Q_OBJECT
public:
    TCPThread();
    ~TCPThread();
protected:
    virtual void run() override;

signals:
    void sigDTUUpdate(int, int);
    void sigDTUUpload(int, int);

private slots:
    void handleTimeout();
    void readData();

private:
    QByteArray cmdSend;
    QTimer* m_timer;
    clock_t begin,end;
    QTcpSocket* tcpSocket;
};




#endif // TCPTHREAD_H
